<template>
  <div @click="showDrawer" class="button">本地上传</div>
  <a-drawer :width="430" v-model:open="open" placement="right">
    <template #title> 冲突设置 </template>
    <presets-radio v-model:value="presetsValue" />
    <template #footer>
      <div style="text-align: right">
        <a-space>
          <animation-add-to target="#publish-button" ref="animationRef">
            <upload-local
              @start="onUploadLocalStart"
              @end="onUploadLocalEnd"
              :params="{ strategy: presetsValue }"
            >
              <a-button type="primary" :loading="loading"> 确定 </a-button>
            </upload-local>
          </animation-add-to>
          <a-button @click="onClose">取消</a-button>
        </a-space>
      </div>
    </template>
  </a-drawer>
</template>
<script setup>
import { ref } from 'vue'
import AnimationAddTo from '@/components/animation-add-to.vue'
import UploadLocal from './upload-local.vue'
import PresetsRadio from './file-conflict-presets-radio.vue'

/**
 * 外部参数
 */
let props = defineProps({})
/**
 * 抽屉相关
 */
let open = ref(false)
let showDrawer = () => {
  open.value = true
}
function onClose() {
  open.value = false
}
/**
 * 本地上传动画
 */
let animationRef = ref(1)
let loading = ref(false)
function onUploadLocalStart() {
  animationRef.value.play()
  // open.value = false
  loading.value = true
}
function onUploadLocalEnd() {
  open.value = false
  loading.value = false
}
/**
 * 预设值
 */
let presetsValue = ref(1)
</script>
<style scoped lang="less"></style>
